/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.Arrays;

/**
 * <p>Project: app2022 - Demo
 * <p>Powered by webrx On 2022-02-08 17:39:50
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] args) {
        var s = String.class;
        var ms = s.getDeclaredMethods();
        StringBuilder sbu = new StringBuilder();
        int rows = 0;
        for (Method m : ms) {
            var p = m.getParameters();
            for (Parameter pa : p) sbu.append(pa.getType()).append(" ").append(pa.getName()).append(",");
            if (sbu.length() > 0) sbu.deleteCharAt(sbu.length() - 1);
            System.out.printf("%d、String.%s(%s);%n", ++rows, m.getName(), sbu);
            sbu.delete(0, sbu.length());
        }
    }

    public static void test(String[] args) {
        var s = Demo.class;
        var ms = s.getDeclaredMethods(); //Method[]
        Arrays.stream(ms).forEach(m -> {
            String mn = m.getName();
            String str = String.format("%s()", mn);
            System.out.println(str);
        });
    }

    private int pf(int a, int b) {
        return 0;
    }
}
